www.gusucode.com > VC++仿XP免费Prof UIS界面库-源码程序 > VC++仿XP免费Prof UIS界面库-源码程序/code/Samples/FullScreenState/MainFrm.cpp
//Download by http://www.NewXing.com // MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "FullScreenState.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_COMMAND(ID_VIEW_LIKE_OFFICE_2K, OnViewLikeOffice2k) ON_UPDATE_COMMAND_UI(ID_VIEW_LIKE_OFFICE_2K, OnUpdateViewLikeOffice2k) ON_COMMAND(ID_VIEW_LIKE_OFFICE_XP, OnViewLikeOfficeXp) ON_UPDATE_COMMAND_UI(ID_VIEW_LIKE_OFFICE_XP, OnUpdateViewLikeOfficeXp) ON_COMMAND(ID_VIEW_LIKE_OFFICE_2003, OnViewLikeOffice2003) ON_UPDATE_COMMAND_UI(ID_VIEW_LIKE_OFFICE_2003, OnUpdateViewLikeOffice2003) ON_COMMAND(ID_VIEW_FULL_SCREEN, OnViewFullScreen) ON_UPDATE_COMMAND_UI(ID_VIEW_FULL_SCREEN, OnUpdateViewFullScreen) ON_WM_GETMINMAXINFO() //}}AFX_MSG_MAP ON_COMMAND_EX(ID_VIEW_MENUBAR, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_MENUBAR, OnUpdateControlBarMenu) ON_COMMAND_EX(IDR_TOOLBAR1, OnBarCheck ) ON_UPDATE_COMMAND_UI(IDR_TOOLBAR1, OnUpdateControlBarMenu) ON_COMMAND_EX(IDR_TOOLBAR2, OnBarCheck ) ON_UPDATE_COMMAND_UI(IDR_TOOLBAR2, OnUpdateControlBarMenu) ON_COMMAND_EX(IDR_TOOLBAR3, OnBarCheck ) ON_UPDATE_COMMAND_UI(IDR_TOOLBAR3, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_0, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_0, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_1, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_1, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_2, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_2, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_3, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_3, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_4, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_4, OnUpdateControlBarMenu) ON_COMMAND_EX(ID_VIEW_RESIZABLE_BAR_5, OnBarCheck ) ON_UPDATE_COMMAND_UI(ID_VIEW_RESIZABLE_BAR_5, OnUpdateControlBarMenu) END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() : m_bFullScreen( FALSE ) { g_PaintManager.InstallPaintManager( new CExtPaintManagerOffice2003 ); // window placement persistence ::memset( &m_wpInitial, 0, sizeof(WINDOWPLACEMENT) ); m_wpInitial.length = sizeof(WINDOWPLACEMENT); m_wpInitial.showCmd = SW_HIDE; CExtPopupMenuWnd::g_bMenuExpanding = false; CExtPopupMenuWnd::g_bMenuHighlightRarely = false; //CExtPopupMenuWnd::g_bMenuWithShadows = false; } CMainFrame::~CMainFrame() { } void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI) { // CFrameWnd::OnUpdateControlBarMenu( pCmdUI ); CExtControlBar::DoFrameBarCheckUpdate( this, pCmdUI, false ); } BOOL CMainFrame::OnBarCheck(UINT nID) { // return CFrameWnd::OnBarCheck( nID ); return CExtControlBar::DoFrameBarCheckCmd( this, nID, false ); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T('\0') ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T('\0') ); ASSERT( pApp->m_pszProfileName != NULL ); g_CmdManager->ProfileSetup( pApp->m_pszProfileName, GetSafeHwnd() ); VERIFY( g_CmdManager->UpdateFromMenu( pApp->m_pszProfileName, IDR_MAINFRAME ) ); VERIFY( g_CmdManager->UpdateFromMenu( pApp->m_pszProfileName, IDR_MDITYPE ) ); m_wndMenuBar.SetMdiWindowPopupName( _T("Window") ); if( !m_wndMenuBar.Create( NULL, // _T("Menu Bar"), this, ID_VIEW_MENUBAR ) ) { TRACE0("Failed to create menubar\n"); return -1; // failed to create } if( !m_wndToolBar.Create( _T("Standard"), this, AFX_IDW_TOOLBAR ) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME) ) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if( !m_wndToolBar1.Create( _T("ToolBar 1"), this, IDR_TOOLBAR1 ) || !m_wndToolBar1.LoadToolBar(IDR_TOOLBAR1) ) { TRACE0("Failed to create toolbar1\n"); return -1; // fail to create } if( !m_wndToolBar2.Create( _T("ToolBar 2"), this, IDR_TOOLBAR2 ) || !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR2) ) { TRACE0("Failed to create toolbar2\n"); return -1; // fail to create } if( !m_wndToolBar3.Create( _T("ToolBar 3"), this, IDR_TOOLBAR3 ) || !m_wndToolBar3.LoadToolBar(IDR_TOOLBAR3) ) { TRACE0("Failed to create toolbar3\n"); return -1; // fail to create } CExtCmdItem * pCmdItem; pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_VIEW_LIKE_OFFICE_2K ); ASSERT( pCmdItem != NULL ); pCmdItem->m_sToolbarText = _T("Show me 2000"); pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_VIEW_LIKE_OFFICE_XP ); ASSERT( pCmdItem != NULL ); pCmdItem->m_sToolbarText = _T("Toggle to modern XP"); pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_VIEW_LIKE_OFFICE_2003 ); ASSERT( pCmdItem != NULL ); pCmdItem->m_sToolbarText = _T("I like 2003"); pCmdItem = g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_VIEW_LIKE_OFFICE_2003 ); ASSERT( pCmdItem != NULL ); pCmdItem->m_sToolbarText = _T("I like 2003"); if( !m_wndResizableBar0.Create( _T("Resizable Bar 0"), this, ID_VIEW_RESIZABLE_BAR_0 ) || !m_wndResizableBar1.Create( _T("Resizable Bar 1"), this, ID_VIEW_RESIZABLE_BAR_1 ) || !m_wndResizableBar2.Create( _T("Resizable Bar 2"), this, ID_VIEW_RESIZABLE_BAR_2 ) || !m_wndResizableBar3.Create( _T("Resizable Bar 3"), this, ID_VIEW_RESIZABLE_BAR_3 ) || !m_wndResizableBar4.Create( _T("Resizable Bar 4"), this, ID_VIEW_RESIZABLE_BAR_4 ) || !m_wndResizableBar5.Create( _T("Resizable Bar 5"), this, ID_VIEW_RESIZABLE_BAR_5 ) ) { TRACE0("Failed to create \"m_wndResizableBar\"s\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } #if (!defined __EXT_MFC_NO_TABMDI_CTRL) if( !m_wndMdiTabs.Create(this) ) { ASSERT( FALSE ); return -1; } #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL) m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar1.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar3.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar0.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar1.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar2.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar3.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar4.EnableDocking(CBRS_ALIGN_ANY); m_wndResizableBar5.EnableDocking(CBRS_ALIGN_ANY); if( !CExtControlBar::FrameEnableDocking(this) ) { ASSERT( FALSE ); return -1; } #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS) if( !CExtControlBar::FrameInjectAutoHideAreas(this) ) { ASSERT( FALSE ); return -1; } #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS) bool bInitialFullScreenMode = pApp->GetProfileInt( _T("Full-Screen-Settings"), _T("Full-Screen-Mode"), 0 ) ? true : false; ASSERT( !m_bFullScreen ); if( bInitialFullScreenMode ) { _DoViewFullScreen( false ); ASSERT( m_bFullScreen ); } // if( bInitialFullScreenMode ) else { VERIFY( _DoBarStateSerialization(bInitialFullScreenMode,false,true) ); } // else from if( bInitialFullScreenMode ) return 0; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CMDIFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { if( m_wndMenuBar.TranslateMainFrameMessage(pMsg) ) return TRUE; return CMDIFrameWnd::PreTranslateMessage(pMsg); } BOOL CMainFrame::DestroyWindow() { CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T('\0') ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T('\0') ); bool bFinalFullScreenMode = m_bFullScreen ? true : false; VERIFY( pApp->WriteProfileInt( _T("Full-Screen-Settings"), _T("Full-Screen-Mode"), bFinalFullScreenMode ? 1 : 0 ) ); VERIFY( _DoBarStateSerialization(bFinalFullScreenMode,true) ); g_CmdManager->ProfileWndRemove( GetSafeHwnd() ); return CMDIFrameWnd::DestroyWindow(); } void CMainFrame::OnViewLikeOffice2k() { if( !g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerXP) ) ) return; VERIFY( g_PaintManager.InstallPaintManager( new CExtPaintManager ) ); RecalcLayout(); RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); CExtControlBar::stat_RedrawFloatingFrames( this ); CExtControlBar::stat_RecalcBarMetrics( this ); } void CMainFrame::OnUpdateViewLikeOffice2k(CCmdUI* pCmdUI) { pCmdUI->Enable(); pCmdUI->SetRadio( g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerXP) ) ? FALSE : TRUE ); } void CMainFrame::OnViewLikeOfficeXp() { if( g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerXP) ) && (! g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerOffice2003) ) ) ) return; VERIFY( g_PaintManager.InstallPaintManager( new CExtPaintManagerXP ) ); RecalcLayout(); RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); CExtControlBar::stat_RedrawFloatingFrames( this ); CExtControlBar::stat_RecalcBarMetrics( this ); } void CMainFrame::OnUpdateViewLikeOfficeXp(CCmdUI* pCmdUI) { pCmdUI->Enable(); pCmdUI->SetRadio( ( g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerXP) ) && (! g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerOffice2003) ) ) ) ? TRUE : FALSE ); } void CMainFrame::OnViewLikeOffice2003() { if( g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerOffice2003) ) ) return; VERIFY( g_PaintManager.InstallPaintManager( new CExtPaintManagerOffice2003 ) ); RecalcLayout(); RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); CExtControlBar::stat_RedrawFloatingFrames( this ); CExtControlBar::stat_RecalcBarMetrics( this ); } void CMainFrame::OnUpdateViewLikeOffice2003(CCmdUI* pCmdUI) { pCmdUI->Enable(); pCmdUI->SetRadio( g_PaintManager->IsKindOf( RUNTIME_CLASS(CExtPaintManagerOffice2003) ) ? TRUE : FALSE ); } void CMainFrame::ActivateFrame(int nCmdShow) { // window placement persistence if( m_wpInitial.showCmd != SW_HIDE ) { SetWindowPlacement( &m_wpInitial ); CFrameWnd::ActivateFrame( m_wpInitial.showCmd ); m_wpInitial.showCmd = SW_HIDE; return; } CMDIFrameWnd::ActivateFrame(nCmdShow); } void CMainFrame::OnViewFullScreen() { _DoViewFullScreen( true ); } void CMainFrame::_DoViewFullScreen( bool bSavePrevLayout ) { if( m_bFullScreen ) { m_bFullScreen = false; if( bSavePrevLayout ) { VERIFY( _DoBarStateSerialization(true,true) ); } SetWindowPlacement( &m_wpSavedBeforeFullScreen ); VERIFY( _DoBarStateSerialization(false,false) ); } // if( m_bFullScreen ) else { GetWindowPlacement( &m_wpSavedBeforeFullScreen ); CRect rcDesktop; ::GetWindowRect( ::GetDesktopWindow(), &rcDesktop ); CRect rcMdiClient; GetClientRect( &rcMdiClient ); ClientToScreen( &rcMdiClient ); CRect rcMdiFrame; GetWindowRect( &rcMdiFrame ); rcMdiFrame.InflateRect( rcMdiClient.left-rcDesktop.left, rcMdiClient.top-rcDesktop.top, rcDesktop.right-rcMdiClient.right, rcDesktop.bottom-rcMdiClient.bottom ); WINDOWPLACEMENT wpFullScreen; ::memcpy( &wpFullScreen, &m_wpSavedBeforeFullScreen, sizeof(WINDOWPLACEMENT) ); wpFullScreen.showCmd = SW_SHOWNORMAL; wpFullScreen.rcNormalPosition = rcMdiFrame; wpFullScreen.ptMaxPosition = rcMdiFrame.TopLeft(); m_sizeFullScreenDesktopDifference = rcMdiFrame.Size() - rcDesktop.Size(); m_bFullScreen = true; if( bSavePrevLayout ) { VERIFY( _DoBarStateSerialization(false,true) ); } SetWindowPlacement( &wpFullScreen ); VERIFY( _DoBarStateSerialization(true,false) ); } // else from if( m_bFullScreen ) } void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI) { pCmdUI->SetCheck( m_bFullScreen ); } void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { if( m_bFullScreen ) _DoFullScreenGetMinMaxInfo( lpMMI ); else CMDIFrameWnd::OnGetMinMaxInfo( lpMMI ); } bool CMainFrame::_DoBarStateSerialization( bool bFullScreenState, bool bSaveState, bool bInitialLoad // = false ) { CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T('\0') ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T('\0') ); CString sSpan = pApp->m_pszProfileName; sSpan += _T("\\"); sSpan += bFullScreenState ? _T("BarPos-FullScreen") : _T("BarPos-Normal") ; RecalcLayout(); bool bRetVal = false; if( bSaveState ) bRetVal = CExtControlBar::ProfileBarStateSave( this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, (LPCTSTR)sSpan ); else bRetVal = CExtControlBar::ProfileBarStateLoad( this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, (LPCTSTR)sSpan, &m_wpInitial ); if( !bSaveState ) { if( !bRetVal ) { _DoInitialDock( bFullScreenState ); bRetVal = true; } // if( !bRetVal ) else if( (!bInitialLoad) && (!m_bFullScreen) ) { ActivateFrame( m_wpInitial.showCmd ); RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW |RDW_ERASE|RDW_ERASENOW |RDW_FRAME|RDW_ALLCHILDREN ); } // else if( (!bInitialLoad) && (!m_bFullScreen) ) if( !bInitialLoad ) m_wpInitial.showCmd = SW_HIDE; } // if( !bSaveState ) return bRetVal; } void CMainFrame::_DoInitialDock( bool bFullScreenState ) { if( bFullScreenState ) { CRect wrAlredyDockedBar; DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndToolBar1,AFX_IDW_DOCKBAR_LEFT); RecalcLayout(); m_wndToolBar1.GetWindowRect( &wrAlredyDockedBar ); wrAlredyDockedBar.OffsetRect( 0, 1 ); DockControlBar(&m_wndToolBar2,AFX_IDW_DOCKBAR_LEFT,&wrAlredyDockedBar); RecalcLayout(); FloatControlBar(&m_wndToolBar3,CPoint(400,50)); RecalcLayout(); static CSize _sizeInitH( 250, 100 ), _sizeInitV( 100, 250 ), _sizeInitF( 250, 250 ); m_wndResizableBar0.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar0.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar0.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar1.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar1.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar1.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar2.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar2.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar2.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar3.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar3.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar3.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar4.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar4.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar4.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar5.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar5.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar5.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar0.DockControlBar(AFX_IDW_DOCKBAR_RIGHT, 1,this); m_wndResizableBar1.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM,2,this); m_wndResizableBar2.DockControlBar(AFX_IDW_DOCKBAR_RIGHT, 3,this); m_wndResizableBar3.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM,4,this); m_wndResizableBar4.DockControlBar(AFX_IDW_DOCKBAR_RIGHT, 5,this); m_wndResizableBar5.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM,6,this); ShowControlBar(&m_wndStatusBar,FALSE,TRUE); ShowControlBar(&m_wndMenuBar,FALSE,TRUE); ShowControlBar(&m_wndToolBar,FALSE,TRUE); ShowControlBar(&m_wndToolBar1,FALSE,TRUE); ShowControlBar(&m_wndToolBar2,FALSE,TRUE); ShowControlBar(&m_wndResizableBar0,FALSE,TRUE); ShowControlBar(&m_wndResizableBar1,FALSE,TRUE); ShowControlBar(&m_wndResizableBar2,FALSE,TRUE); ShowControlBar(&m_wndResizableBar3,FALSE,TRUE); ShowControlBar(&m_wndResizableBar4,FALSE,TRUE); ShowControlBar(&m_wndResizableBar5,FALSE,TRUE); RecalcLayout(); } // if( bFullScreenState ) else { CRect wrAlredyDockedBar; DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); RecalcLayout(); m_wndToolBar.GetWindowRect( &wrAlredyDockedBar ); wrAlredyDockedBar.OffsetRect( 1, 0 ); DockControlBar(&m_wndToolBar1,AFX_IDW_DOCKBAR_TOP,&wrAlredyDockedBar); RecalcLayout(); m_wndToolBar1.GetWindowRect( &wrAlredyDockedBar ); wrAlredyDockedBar.OffsetRect( 1, 0 ); DockControlBar(&m_wndToolBar2,AFX_IDW_DOCKBAR_TOP,&wrAlredyDockedBar); RecalcLayout(); m_wndToolBar2.GetWindowRect( &wrAlredyDockedBar ); wrAlredyDockedBar.OffsetRect( 1, 0 ); DockControlBar(&m_wndToolBar3,AFX_IDW_DOCKBAR_TOP,&wrAlredyDockedBar); RecalcLayout(); static CSize _sizeInitH( 250, 100 ), _sizeInitV( 100, 250 ), _sizeInitF( 250, 250 ); m_wndResizableBar0.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar0.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar0.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar1.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar1.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar1.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar2.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar2.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar2.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar3.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar3.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar3.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar4.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar4.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar4.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar5.SetInitDesiredSizeHorizontal( _sizeInitH ); m_wndResizableBar5.SetInitDesiredSizeVertical( _sizeInitV ); m_wndResizableBar5.SetInitDesiredSizeFloating( _sizeInitF ); m_wndResizableBar0.DockControlBar(AFX_IDW_DOCKBAR_LEFT,1,this,false); m_wndResizableBar0.DockControlBar(&m_wndResizableBar1,true,true); m_wndResizableBar2.DockControlBar(AFX_IDW_DOCKBAR_RIGHT,1,this,false); m_wndResizableBar2.DockControlBar(&m_wndResizableBar3,false,true); m_wndResizableBar2.GetParentFrame()->RecalcLayout(); m_wndResizableBar3.DockControlBar(&m_wndResizableBar4,false,true); m_wndResizableBar2.GetParentFrame()->RecalcLayout(); m_wndResizableBar0.DockControlBar(&m_wndResizableBar5,false,true); RecalcLayout(); } // else from if( bFullScreenState ) } void CMainFrame::_DoFullScreenGetMinMaxInfo( LPMINMAXINFO lpMMI ) { ASSERT( m_bFullScreen ); CRect rcDesktop; ::GetWindowRect( ::GetDesktopWindow(), &rcDesktop ); CSize _size = rcDesktop.Size() + m_sizeFullScreenDesktopDifference ; lpMMI->ptMaxSize.x = _size.cx; lpMMI->ptMaxSize.y = _size.cy; lpMMI->ptMaxTrackSize.x = _size.cx; lpMMI->ptMaxTrackSize.y = _size.cy; }